<div class="divColorbox">
    <div class="divColorbox_Header">
        <span><i class="fa fa-star"></i><span>修改用户信息</span></span>
        <a class="Refresh"></a><a class="Close"></a>
    </div>
    <div class="divColorbox_Body row">
        <div>
            <input name="User_ID" type="hidden"/>
            <div class="row">
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">用户ID</span>
                        <input id="User_ID" type="text" class="form-control" value="-------------" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">昵称</span>
                        <input id="NickName" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">手机号</span>
                        <input id="Phone" type="text" class="form-control" disabled/>
                    </div>
                </div>
            </div>
            <div class="space-6"></div>
            <div class="row">
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">是否艺人</span>
                        <input id="IsAnchor" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">是否公会</span>
                        <input id="IsFamily" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">是否VIP</span>
                        <input id="VIP" type="text" class="form-control" disabled/>
                    </div>
                </div>
            </div>
            <div class="space-6"></div>
            <div class="row">
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">QQ</span>
                        <input id="QQ" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">邮箱</span>
                        <input id="Anchor_Email" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <div class="col-sm-4">
                    <div class="input-group">
                        <span class="input-group-addon">用户状态</span>
                        <input id="Status" type="text" class="form-control" disabled/>
                    </div>
                </div>
            </div>
            <div class="hr"></div>
            <div class="space-6"></div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="input-group">
                        <button type="button" id="btnEdit_Alter" class="btn btn-primary">
                            <i class="fa fa-check"></i> 重置密码
                        </button>
                        <!--<span class="input-group-addon">开户帐号</span>-->
                        <input id="NewPwd" type="text" class="form-control" disabled/>
                    </div>
                </div>
                <!--<div class="col-sm-6">-->
                    <!--<div class="input-group">-->
                        <!--<span class="input-group-addon">开户帐号</span>-->
                        <!--<input id="Account_CardNo" type="text" class="form-control" />-->
                        <!--<span class="input-group-addon"><i class="fa fa-pencil"></i></span>-->
                    <!--</div>-->
                <!--</div>-->
            </div>
        </div>
    </div>
    <div class="divColorbox_Footer">

        <button type="button" id="btnEdit_Alters" class="btn btn-primary">
            <i class="fa fa-check"></i>  <span id="J_Freeze_En"></span>
        </button>
        <button type="button" id="btnUndo"></button>
    </div>
</div>
<script src="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/jquery.uploadifive.min.js"></script>
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.css">
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/uploadifive/uploadifive.custom.css">
<div id="UploadifiveQueue"></div>
<script>
    $(function () {
        if (_PageData.flag != 0) {
            $.KOC.Tips.Open("Error", _PageData.flag, {
                Timeout: 1000,
                onClose: function () {
                    parent.$.colorbox.close();
                }
            });
            return;
        }
        //////////////////////////////////////////////////////////
        //重置密码
        //////////////////////////////////////////////////////////
        $('#btnEdit_Alter').on('click', function () {
            var params = {};
            params.User_ID = $.trim($('#User_ID').val());
            if (! params.User_ID) {
                $.KOC.Tips.Open('Error', '参数出错，请联系研发部', {Timeout: 2000});
                $('#User_ID').focus();
                return false;
            }
            $.KOC.Loading.Open();
            $.ajax({
                url: '/ajax/user.user-info.user-passwordreset',
                type: 'post',
                dataType: 'json',
                data: {
                   User_ID:params.User_ID
                },
                success: function (data) {
                    $.KOC.Loading.Close();
                    if (data.flag !== 0) {
                        $.KOC.Tips.Open("Error", data.msg + "(" + data.flag + ")", {Timeout: 2000});
                        return;
                    }
                    $.KOC.Tips.Open('Success', '密码修改成功', {
                        Timeout: 1000,
                        onClose: function () {
                            $('#NewPwd').val(data.data.Password);
                        }
                    });
                }
            });
        });

        //////////////////////////////////////////////////////////
        //修改用户信息
        //////////////////////////////////////////////////////////
//        $('#aaa').click(function () {
//            var params = {};
//            var tel = /^0?(13[0-9]|15[012356789]|18[0123456789]|17[0123456789]|14[57])[0-9]{8}$|^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]+$/;
//            params.User_ID = $.trim($('#User_ID').val());//User_ID
//            params.Phone = $.trim($('#Phone').val());//手机号lableid
//            if (!params.Phone) {
//                $.KOC.Tips.Open('Error', '请输入手机号', {Timeout: 1000});
//                $('#Phone').focus();
//                return false;
//            } else if (!tel.test(params.Phone)) {
//                $.KOC.Tips.Open('Error', '你输入的手机号格式不正确', {Timeout: 1000});
//                $('#Phone').focus();
//                return false;
//            }
//            $.KOC.Loading.Open();
//            $.ajax({
//                url: '/ajax/user.user-anchor.update',
//                type: 'post',
//                dataType: 'json',
//                data: {
//                    User_ID:params.User_ID,
//                    Phone: params.Phone,
//                },
//                success: function (data) {
//                    $.KOC.Loading.Close();
//                    if (data.flag !== 0) {
//                        $.KOC.Tips.Open("Error", data.msg + "(" + data.flag + ")", {Timeout: 2000});
//                        return;
//                    }
//                    $.KOC.Tips.Open('Success', '修改完成', {
//                        Timeout: 1000,
//                        onClose: function () {
//                            parent.$.colorbox.close();
//                            parent.window.location.href  = "/user-manage/anchor-manage/list";
//                        }
//                    });
//                }
//            });
//
//        });

        //////////////////////////////////////////////////////////
        //冻结解冻
        //////////////////////////////////////////////////////////
        $('#btnEdit_Alters').on('click', function () {
            var params = {};
            params.User_ID = $.trim($('#User_ID').val());
            params.Status=$.trim($('#Status').val());
            if( params.Status=='封号'){
                params.Status=2;
            }else{
                params.Status=1;
            }
            if (!params.User_ID) {
                $.KOC.Tips.Open('Error', '数据出错请刷新', {Timeout: 2000});
                return false;
            }
            $.KOC.Loading.Open();
            $.ajax({
                url: '/ajax/user.user-info.userblock',
                type: 'post',
                dataType: 'json',
                data: {
                    User_ID: params.User_ID,
                    Status: params.Status
                },
                success: function (data) {
                    $.KOC.Loading.Close();
                    if (data.flag !== 0) {
                        $.KOC.Tips.Open("Error", data.msg + "(" + data.flag + ")", {Timeout: 2000});
                        return;
                    }
                    $.KOC.Tips.Open('Success', '修改完成', {
                        Timeout: 1000,
                        onClose: function () {
                            parent.$.colorbox.close();
                            parent.window.location.href = "/user-manage/info-manage/list";
                        }
                    });
                }
            });
        });
        //////////////////////////////////////////////////////////
        //数据绑定
        //////////////////////////////////////////////////////////
        $('#User_ID').val(_PageData.User_ID);
        $('#NickName').val(_PageData.NickName);
        $('#Phone').val(_PageData.Phone);
        $('#QQ').val(_PageData.QQ);
        $('#Email').val(_PageData.Email);
        $('#Level').val(_PageData.Level.Level);
        $('#Account_RealName').val(_PageData.Account_RealName);
        $('#Account_CardNo').val(_PageData.Account_CardNo);
        switch (_PageData.Status){
            case 0 :
                $("#Status").val('正常');
                $('#J_Freeze_En').text('封号');
                break;
            case 1 :
                $("#Status").val('封号');
                $('#J_Freeze_En').text('解冻');
                break;
            default:
                $('#Status').val('_');
                break;
        }
        switch (_PageData.IsAnchor){
            case 0 :
                $("#IsAnchor").val('否');
                break;
            case 1 :
                $("#IsAnchor").val('是');
                break;
            default:
                $('#IsAnchor').val('——');
                break;
        }
        switch (_PageData.IsFamily){
            case 0 :
                $("#IsFamily").val('否');
                break;
            case 1 :
                $("#IsFamily").val('是');
                break;
            default:
                $('#IsFamily').val('——');
                break;
        }
        switch (_PageData.VIP){
            case 0 :
                $("#VIP").val('否');
                break;
            case 1:
                $("#VIP").val('是');
                break;
            default:
                $('#VIP').val('——');
                break;
        }
        switch (_PageData.Sex){
            case 1 :
                $("#Sex").val('男');
                break;
            case 2 :
                $("#Sex").val('女');
                break;
            default:
                $('#Sex').val('');
                break;
        }
    });
</script>